/**
 * 
 */
package org.lex.depends.core.asm;

import java.util.Queue;

public class VisitMethod extends VisitorAdapter {
	private final Queue<String> queue;

	public VisitMethod(Queue<String> queue) {
		this.queue = queue;
	}

	@Override
	public void visitFieldInsn(int opcode, String owner, String name, String desc) {
		log.trace(("owner=" + owner + ", name=" + name + ", desc=" + desc));
		queue.offer(getClassName(owner));
	}

	@Override
	public void visitMethodInsn(int opcode, String owner, String name, String desc) {
		log.trace(("owner=" + owner + ", name=" + name + ", desc=" + desc));
		queue.offer(getClassName(owner));
	}

	private String getClassName(String owner) {
		return owner.replace('/', '.');
	}
}